// ************************************************************
// Copyright © 2021
// File Name: main.go
// Author:
// Email:
// Created: 2021-12-26 22:21:08 (CST)
// Last Update:
//          By:
// Description:
// ************************************************************

package main

import (
	"bookstore/api"
	"bookstore/internal/task"

	"github.com/gotomicro/ego"
	"github.com/gotomicro/ego/core/elog"
	"github.com/gotomicro/ego/server/egrpc"
	"github.com/gotomicro/ego/task/ejob"
)

// export EGO_DEBUG=true && go run main.go --config=configs/config.toml
func main() {
	if err := ego.New().Serve(func() *egrpc.Component {
		server := egrpc.Load("server.grpc").Build()
		api.RegisterBookInfoServer(server, InitBookInfoService())
		return server
	}()).Job(ejob.Job("say_hello", task.Hello)).Run(); err != nil {
		elog.Panic("startup", elog.FieldErr(err))
	}
}
